using System;

namespace Galplay {
  internal class ScriptCommand : GalScript {
    public string Command { get; set; }

    public ScriptCommand(GalScene owner, XmlNode item): base(owner, item, ScriptType.Command) {
      Command = item.InnerText;
    }

    public bool IsCommand(string text){
      return text.Equals(Command, StringComparison.OrdinalIgnoreCase);
    }

    public override void Execute(GameScenePlayer player) {
      if (IsCommand("StopBGS")){
        GM.StopBgs();
      }else if (IsCommand("StopBGM")){
        GM.StopBgm();
      }else if (IsCommand("StopSE")){
        GM.StopSe();
      }else if (IsCommand("ClearPicture")){
        player.imageManager.HideAll();
      }else{
        // 无法识别的命令
        Debuger.LogError($"[{Index}]Undefined Command:{Command}");
      }
    }
  }
}